import Api from '@/api/finance/withdraw'
import i18n from "@/lang/index";
// import ExportsApi from '@/api/system/exports'
const contentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    // highlightCurrentRow: true,
  },
  indexAction: (data) => {
    console.log("index", data);
    return new Promise((resolve, reject) => {
      Api.getList(data).then(s => {
        console.log(s);
        resolve(s)
      }).catch(e => {
        console.log(e);
        reject(e)
      })
    });
  },
  deleteAction: function (id) {
    console.log("delete", id);
    return new Promise((resolve, reject) => {
      Api.del({ id }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.7"),
        })
      }).catch(e => {
        reject(e)
      })
    });
  },
  exportAction: function (queryParams) {
    // 导出Excel文件
    return new Promise((resolve, reject) => {
      Api.exports({ ...queryParams, ...{ type: 'withdrawal' } }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.85"),
        })
      }).catch(e => {
        reject(e)
      })
    });
  },
  pk: "id",
  // defSearch: true,
  toolbar: [
    "refresh",
    // "add",
    // "delete",
    "export",
    // {
    //   name: "import",
    //   icon: "upload",
    //   text: "导入",
    //   auth: "import",
    // },
  ],
  cols: [
    { label: i18n.global.t("label.15"), align: "center", prop: "user_id", width: 100,fixed:'left' },
    { label: i18n.global.t("label.9"), align: "center", prop: "user.username", width: 150 ,fixed: "left"},
    { label: i18n.global.t("label.16"), align: "center", prop: "ulid" ,width: 250,fixed:'left'},
    { label: i18n.global.t("label.117"), align: "center", prop: "parent_id",  },
    { label: i18n.global.t("label.17"), align: "center", prop: "amount" },
    { label: i18n.global.t("label.12"), align: "center", prop: "currency_code" },
    // { label: i18n.global.t("label.18"), align: "center", prop: "account_type", width: 90 },
    { label: i18n.global.t("label.19"), align: "center", prop: "payee_account" },
    { label: i18n.global.t("label.20"), align: "center", prop: "payee_name", width: 100 },
    { label: i18n.global.t("label.21"), align: "center", prop: "fee_rate", width: 100 },
    { label: i18n.global.t("label.22"), align: "center", prop: "fees", width: 80 },
    
    { label: i18n.global.t("label.23"), align: "center", prop: "status", templet: 'custom', slotName: "status", width: 120 },
    { label: i18n.global.t("label.24"), align: "center", type: "time", prop: "created_at", minWidth: 180 },
    { label: i18n.global.t("label.25"), align: "center", type: "time", prop: "paid_at", minWidth: 180 },
    { label: i18n.global.t("label.14"),align: "center", prop: "note",minWidth: 180 },
    {
      label: i18n.global.t("label.8"),
      fixed: "right",
      width: 240, 
      align: "center",
      templet: "tool",
      operat: [
        // "edit",
        // "delete",
      ],
    },
  ],
};

export default contentConfig;
